		/*添加*/
		function u_coupon_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		function u_coupon_save_submit(){
			document.getElementById("description").value = $('#summernote').summernote('code');
			$("#coupon_table_form").Validform({
				tiptype:2,
				ajaxPost:true,
				callback:function(form){					
					location.href = ctx+"/coupon-list";			
				}
			});
		}

		function add_new_charge() {
			var rowLen = $('#charge').find('tbody tr').length + 1;
			var html = "<tr><td class='col-xs-1'>"
					+ rowLen
					+ "</td><td class='col-xs-3'><input type='text'"
					+ "class='form-control' style='min-width: 10px'"
					+ "name='coupon_amout' datatype='*1-50' nullmsg='填写优惠金额'"
					+ "value=''></td>"
					+ "<td class='col-xs-1'><input type='text'"
					+ "	class='form-control' style='min-width: 10px' name='use_limit1'"
					+ "	value=''></td>"
					+ "	<td class='col-xs-2'><input type='text'"
					+ "	class='form-control' style='min-width: 10px'"
					+ "	name='coupon_count' datatype='n1-10' nullmsg='不能为空并且必须是整数'"
					+ "	value=''></td><td class='col-xs-2'><input type='text' id='end_time"+rowLen+"' name='end_time'  readonly class='input-md form-control layer-date' ></td>	"
					+"<td class='col-xs-1'><button class='btn btn-primary radius' type='button'>"
					+"删除</button></td></tr>";
			$('#charge').find('tbody').append(html);
			$('#charge').find('tbody tr:last').find('button').on('click',
			function() {
				$(this).parent().parent().remove();
				$('#charge').find('tbody tr').each(function() {
					var rowIndex = $(this).index() + 1;
					$(this).find('td:eq(0)').text(rowIndex);
				})
			});
			
			$('#end_time'+rowLen).on('click',function() {				
				WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});			
			});
		}

		function coupon_disable(obj){
			$(obj).parent().parent().remove();
		}
		
		function loadlnglat(lng, lat) {
			$("#longitude").val(lng);
			$("#latitude").val(lat);
		}
		
		function getlnglat() {
			var index = layer.open({
				type : 2,
				title : "地图定位",
				content : "baiduditu?lng="
				+ $("#longitude").val() + "&lat="
				+ $("#latitude").val()
			});
			layer.full(index);
		}

	
